package com.gmrz.uaf.db;

import com.gmrz.uaf.common.GuiceUtil;
import com.gmrz.uaf.db.dao.*;
import com.gmrz.webauthn.db.dao.*;

import java.sql.Connection;

public class UAFDAOFactory {

    public static AuthenticatorDAO createAuthenticatorDAO(Connection conn) {
        AuthenticatorDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class)
                .createAuthenticatorDAO(conn);
        return dao;
        //return (AuthenticatorDAO) ProxyUtil.getInstance(dao);
    }

    public static AuthenticatorSpecDAO createAuthenticatorSpecDAO(Connection conn) {
        AuthenticatorSpecDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class)
                .createAuthenticatorSpecDAO(conn);
        return dao;
    }

    public static DevicesDao createDevicesDAO(Connection conn) {
        DevicesDao dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createDevicesDAO(conn);
        return dao;
    }

    public static UasConfigDAO createUasConfigDAO(Connection conn) {
        UasConfigDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createUasConfigDAO(conn);
        return dao;
    }

    public static WhiteListDAO createWhiteListDAO(Connection conn) {
        WhiteListDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createWhiteListDAO(conn);
        return dao;
    }

    public static FidoLogDAO createFidoLogDAO(Connection conn) {
        FidoLogDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createFidoLogDAO(conn);
        return dao;
    }

    public static ServicePluginDAO createServicePluginDAO(Connection conn) {
        ServicePluginDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createServicePluginDAO(conn);
        return dao;
    }

    public static PluginDataDAO createPluginDataDAO(Connection conn) {
        PluginDataDAO dao = GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createPluginDataDAO(conn);
        return dao;
    }

    public static WebAuthnAuthenticatorsDAO createWebAuthnAuthenticatorsDAO(Connection conn) {
        return GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createWebAuthnAuthenticatorsDAO(conn);
    }

    public static WebAuthnPolicyDAO createWebAuthnPolicyDAO(Connection conn) {
        return GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createWebAuthnPolicyDAO(conn);
    }

    public static TenantConfigDAO createTenantConfigDAO(Connection conn) {
        return GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createTenantConfigDAO(conn);
    }


    public static FacetsDAO createFacetsDAO(Connection conn) {
        return GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createFacetsDao(conn);
    }

    public static WebAuthnMetadataDAO createWebAuthnMetadataDAO(Connection conn) {
        return GuiceUtil.getProcessorInjector().getInstance(DAOFactory.class).createWebAuthnMetadataDAO(conn);
    }

}
